Color

interface Color

A numeric model of an RGB color. The components of the color instance are presented in the arithmetic notation. This means that each component accepts any fractional value from 0 to 1.

If all the components except alpha are at zero and the alpha is at 1, the result is black. If all are at 1, the result is the brightest representable white.

Important: the component values out of the 0..1 range are not allowed and should not be used.

Types

Link copied to clipboard
class Builder
A builder of Color.

Functions

Link copied to clipboard
open fun alpha(): Float
Returns the opacity channel value in the 0..1 range.
Link copied to clipboard
open fun blue(): Float
Returns the blue channel value in the 0..1 range.
Link copied to clipboard
open fun green(): Float
Returns the green channel value in the 0..1 range.
Link copied to clipboard
open fun isValid(): Boolean
Returns true if this color is a valid color.
Link copied to clipboard
Creates a new Color builder with the given required parameters.
Link copied to clipboard
open fun red(): Float
Returns the red channel value in the 0..1 range.
Link copied to clipboard
open fun rgb(red: Float, green: Float, blue: Float): Color
Creates a new Color instance from the passed RGB values with opacity (alpha) channel set to 1 (non-transparent).
Link copied to clipboard
open fun rgba(red: Float, green: Float, blue: Float, alpha: Float): Color
Creates a new Color instance from the passed RGBA values.
Link copied to clipboard
open fun toHexRGB(): String
Returns a string representation for this color in the #RGB hex format.
Link copied to clipboard
open fun toHexRGBA(): String
Returns a string representation for this color in the #RGBA hex format.